package org.sunshine.miracle.ui;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;

public class MainShell {

    private static final Log LOGGER = LogFactory.getLog(MainShell.class);

    private Shell shell;

    public void initUI() {
        LOGGER.debug("Init UI");
        shell = SWTUtils.createShell(SWT.SHELL_TRIM);
        shell.setSize(400, 400);
        shell.setText(StringBundle.getResourceString("mainshell.title"));
        SWTUtils.setCenter(shell);
        shell.setLayout(new FillLayout());


        new MainShellMenu(shell);


        SashForm sashForm = new SashForm(shell, SWT.NONE);
        sashForm.setOrientation(SWT.HORIZONTAL);

        FileTree fileTree = new FileTree(sashForm, shell);

        FileInfoPanel infoPanel = new FileInfoPanel(sashForm);

        fileTree.setInfoPanel(infoPanel);


        shell.open();

        LOGGER.debug("UI constructed");
        SWTUtils.loop(shell);
    }

}
